package com.kingsailor.gunsmith.security;

import edu.jetwinner.util.EasySetUtil;

/**
 * 本类是实现用户资源访问的伪实现，主要是用于系统未真正实现低层数据访问机制时调试程序的临时实现
 * @author xulixin
 */
public class DummyUserAuthObjectServiceImpl implements UserAuthObjectService {

    @Override
    public BaseAppUser getBaseAppUserByUsername(String username) {
        BaseAppUser user = new BaseAppUser();
        user.setUsername("admin");
        user.setPassword("FxnzDXLOO8yqOqg64RA5erBujL+iw3z8UvuTr+Y16Ak=");
        user.setLocked(0);
        user.setSalt("2pfHj21OUy1rBfVGyCb6qw==");
        return user;
    }

    @Override
    public UserRolePermission getUserRolePermissionByUsername(String username) {
        BaseAppUser user = getBaseAppUserByUsername(username);
        return new UserRolePermission(user,
                EasySetUtil.of("ROLE_ADMIN", "ROLE_SUPER_ADMIN", "ROLE_GUEST", "ROLE_USER"),
                EasySetUtil.of("TOKEN_ACCESS_ADMIN", "TOKEN_ACCESS_EDIT_USER"));
    }
}
